package com.honglu.backend.service.impl;

import com.honglu.backend.bo.NewGuestStatisticalChannelBo;
import com.honglu.backend.dao.NewGuestStatisticalChannelDao;
import com.honglu.backend.service.NewGuestStatisticalChannelService;
import com.honglu.backend.vo.StatisticalChannelVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by tangbin on 2017/6/12.
 */
@Service
public class NewGuestStatisticalChannelServiceImpl implements NewGuestStatisticalChannelService {

    @Autowired
    private NewGuestStatisticalChannelDao newGuestStatisticalChannelDao;

    @Override
    public List<NewGuestStatisticalChannelBo> getNewGuestStatisticalChannelList(StatisticalChannelVo vo) {
        Map<String, Object> params = new HashMap<>();
        params.put("phoneType", vo.getPhoneType());
        params.put("createStartTime", vo.getCreateStartTime());
        params.put("createEndTime", vo.getCreateEndTime());
        params.put("remark", vo.getRemark());
        params.put("rows", vo.getPageIndex());
        params.put("size", vo.getPageSize());
        List<NewGuestStatisticalChannelBo> list = newGuestStatisticalChannelDao.getNewGuestStatisticalChannelList(params);
        return list;
    }

    @Override
    public Integer getNewGuestStatisticalChannelCount(StatisticalChannelVo vo) {
        Map<String, Object> params = new HashMap<>();
        params.put("phoneType", vo.getPhoneType());
        params.put("createStartTime", vo.getCreateStartTime());
        params.put("createEndTime", vo.getCreateEndTime());
        params.put("remark", vo.getRemark());
        Integer count = newGuestStatisticalChannelDao.getNewGuestStatisticalChannelCount(params);
        return count;
    }

    @Override
    public List<NewGuestStatisticalChannelBo> getNewGuestSummaryChannelList(StatisticalChannelVo vo) {
        Map<String, Object> params = new HashMap<>();
        params.put("source", vo.getSource());
        params.put("createStartTime", vo.getCreateStartTime());
        params.put("createEndTime", vo.getCreateEndTime());
        params.put("remark", vo.getRemark());
        params.put("rows", vo.getPageIndex());
        params.put("size", vo.getPageSize());
        List<NewGuestStatisticalChannelBo> list = newGuestStatisticalChannelDao.getNewGuestSummaryChannelList(params);
        return list;
    }

    @Override
    public Integer getNewGuestSummaryChannelCount(StatisticalChannelVo vo) {
        Map<String, Object> params = new HashMap<>();
        params.put("source", vo.getSource());
        params.put("createStartTime", vo.getCreateStartTime());
        params.put("createEndTime", vo.getCreateEndTime());
        params.put("remark", vo.getRemark());
        Integer count = newGuestStatisticalChannelDao.getNewGuestSummaryChannelCount(params);
        return count;
    }
}
